class CityParamClass:
    # 给一个全部参数的 init
    def __init__(self, city, city_name):
        self.city = city
        self.city_name = city_name

    @staticmethod
    def city_to_dict(cityParams):
        if isinstance(cityParams, CityParamClass):
            return {
                'city': cityParams.city,
                'city_name': cityParams.city_name
            }
        raise TypeError(f'Object of type {cityParams.__class__.__name__} is not JSON serializable')
